package com.hyy.convert;

import com.hyy.common.utils.SecurityUtil;
import com.hyy.dataobject.UserInfo;
import com.hyy.user.api.pojo.UserInfoRegisterRequest;


//UserInfoRegisterRequest转成UserInfo(密码这个字段同样被加密)
public class BeanConvert {
    public static UserInfo convertUserInfoByEncrypt(UserInfoRegisterRequest registerRequest) {
        //用户注册（插入数据库）
        UserInfo userInfo=new UserInfo();

        //数据库需要保存加密后的密码
        userInfo.setUserName(registerRequest.getUserName());
        userInfo.setPassword(SecurityUtil.encrypt(registerRequest.getPassword()));
        userInfo.setGithubUrl(registerRequest.getGithubURL());
        userInfo.setEmail(registerRequest.getEmail());
        return userInfo;
    }
}
